// function mock(app, url, data) {
//   app.get(url, (request, response) => {
//     response.json(data)
//   })
// }
// const mockBookHomeData = require('./src/mock/bookHome')
// const mockBookShelfData = require('./src/mock/bookShelf')
// const mockBookList = require('./src/mock/bookCategoryList')
// const mockBookFlatList = require('./src/mock/bookFlatList')
const CompressionPlugin = require("compression-webpack-plugin");

module.exports = {
  // ? '/etmsapp'现场  "./"测试
  publicPath: process.env.NODE_ENV === 'production'
    ? '/etmsapp'
    : '/',
  assetsDir: 'static',
  productionSourceMap: false,
  outputDir: process.env.outputDir,
  lintOnSave: false,
  configureWebpack: config => {
    if (process.env.NODE_ENV === "production") {
      return {
        plugins: [
          new CompressionPlugin({
            // test: /\.js$|\.html$|\.css/,
            test: /\.(js|css|svg|woff|ttf|json|html)$/,
            threshold: 10240,
            deleteOriginalAssets: false
          })
        ]
      };
    }
  },
  devServer: {
    host: "0.0.0.0",
    port: 8000, // 端口号
    https: false, // https:{type:Boolean}
    open: true, //配置自动启动浏览器  http://XXX.XXX.X.XX:7071/rest/XXX/
    hotOnly: true, // 热更新
    disableHostCheck: true
  },
  configureWebpack: {
    externals: {
      "BMap": "BMap",
    }
  },
}
